feat: enrich transaction history with known transaction data#216
feat: enrich transaction history with known transaction data#216premiumjibles merged 3 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (18)
Disabled knowledge base sources:
📝 WalkthroughWalkthroughThis PR introduces transaction enrichment capabilities by adding support for new transaction types (limitOrder, stopLoss, twap, deposit, withdraw, approval), implementing client-side persistence of known transactions via IndexedDB, and establishing a server-side enrichment pipeline that maps known transactions to on-chain data while accounting for internal native ETH transfers. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Client as agentic-chat<br/>(Client)
participant Storage as IndexedDB<br/>(idb-keyval)
participant Server as agentic-server<br/>(Routes & Tools)
participant Parser as EVM Parser &<br/>Enrichment
participant AIModel as AI Model
User->>Client: Perform transaction (swap, send, etc.)
Client->>Storage: Persist known transaction metadata via ChatStore
User->>Client: Request transaction history
Client->>Storage: Retrieve known transactions
Storage-->>Client: Return KnownTransaction[]
Client->>AIModel: Send chat request with knownTransactions
AIModel->>Server: Forward request via buildWalletContext
Server->>Server: Parse request schema with knownTransactions
Server->>Parser: Call transactionHistoryTool with wallet context
Parser->>Parser: enrichTransactions(allTxs, knownTransactions)
Note over Parser: Map known transactions by txHash<br/>Reclassify contract → swap/send/etc.<br/>Build tokenTransfers for swap-like types
Parser->>Parser: Enhance with internal native transfers
Parser->>Parser: Apply filtering, sorting, pagination
Parser-->>Server: Return enriched transactions
Server-->>Client: Return transaction results
Client->>Client: Render via GetTransactionHistoryUI with new types
Client-->>User: Display enriched transaction history
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.Change the |
Swaps are misclassified as "contract interactions" when Unchained returns incomplete tokenTransfers data. Fix by sending a lightweight known transactions map from the client (built from persistedTransactions) and enriching misclassified contract txs before filtering. Also parse internalTxs from Unchained to classify swaps where native ETH is transferred via internal calls rather than top-level tx.value. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Remove .default() from schema fields that caused LLMs to echo unnecessary parameters. Rewrite types description as positive directive with mapping. Simplify renderTransactions to number-only type. Cap default context at 25 transactions. Move examples from system prompt into tool description. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
667d550 to
5d8928b
Compare
5d8928b to
6cd1f6c
Compare
Add 6 new transaction types (limitOrder, stopLoss, twap, deposit, withdraw, approval) and extract knownTransactions logic from ChatProvider into a chatStore selector that covers all 9 tool types including approval/deposit sub-transactions. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
6cd1f6c to
fb57255
Compare
Summary
limitOrder,stopLoss,twap,deposit,withdraw,approval) across the types package, server enrichment, and chat UIgetKnownTransactions()selector: Moves inlineknownTransactionsbuilder fromChatProvider.tsxintochatStore.ts, covering all 9 transaction-producing tools (swap, swapUsd, send, limitOrder, stopLoss, twap, vaultDeposit, vaultWithdraw, vaultWithdrawAll) with proper sub-transaction handling (approval/deposit sub-txs)ScrollTextfor orders,Vaultfor deposits/withdrawals,ShieldCheckfor approvals), label map, and grouped render logic (isSwapLike,isSendLike,isReceiveLike,isContractLike)Test plan
bun run lint— passesbun run type-check— passes (discriminated union expanded across all consumers)bun test— 828 tests, 0 failures (15 enrichment tests including 8 new ones for new types)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Refactor